import type { categoryTopItem } from '@/types/category'
import type { PageParams, PageResult } from '@/types/global'
import type { goodsListItem } from '@/types/goods'
import { request } from '@/utils/request'

export const getCategoryApi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: '/goods/classify',
  })
}

export const getTopCategoryApi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: '/goods/topClassify',
  })
}

export const getClassifyDetailApi = (
  data: PageParams & {
    classify_id: string
  },
) => {
  return request<PageResult<goodsListItem[]>>({
    method: 'GET',
    url: '/goods/classifyDetail',
    data,
  })
}

export const getAllClassifyADatapi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: '/goods/allClassify',
  })
}
